package com.xiaocikuai.smallchunks.service.Transaction;

import com.alibaba.fastjson.JSONObject;
import com.xiaocikuai.smallchunks.entity.Pay.WX_Native_Request;
import com.xiaocikuai.smallchunks.entity.Product.Product;
import com.xiaocikuai.smallchunks.entity.Transaction.*;
import com.xiaocikuai.smallchunks.entity.User.Duser;
import com.xiaocikuai.smallchunks.entity.User.Membership;
import com.xiaocikuai.smallchunks.entity.User.User;
import com.xiaocikuai.smallchunks.file.PutObject004;
import com.xiaocikuai.smallchunks.mapper.Transaction.*;
import com.xiaocikuai.smallchunks.mapper.User.UserMapper;
import com.xiaocikuai.smallchunks.service.Product.ProductService;
import com.xiaocikuai.smallchunks.service.Transaction.impl.PromotionalUserServiceImpl;
import com.xiaocikuai.smallchunks.service.User.UserService;
import com.xiaocikuai.smallchunks.service.User.impl.MembershipServiceImpl;
import com.xiaocikuai.smallchunks.utils.JWTservice.JwtService;
import com.xiaocikuai.smallchunks.utils.ListStringUtil.ListStringUtil;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.*;

import static com.baomidou.mybatisplus.core.toolkit.Wrappers.lambdaUpdate;


@Service
public class TransactionServices {

    @Resource
    private JTEService jteService;

    @Resource
    private ZTOService ztoService;
    @Resource
    private TransactionMapper transactionMapper;
    @Resource
    private JwtService jwtService;

    @Resource
    private RandomCode randomCode;
    @Resource
    private ProductService productService;

    @Resource
    private UserMapper userMapper;


    @Resource
    private PayMapper payMapper;
    @Resource
    private MembershipServiceImpl membershipService;
    @Resource
    private MaleListMapper maleListMapper;
    @Resource
    private VirtualOrderMapper virtualOrderMapper;

    @Resource
    private RealOrderMapper realOrderMapper;

    @Autowired
    private PutObject004 putObject004;

    @Resource
    private BillMapper billMapper;

    @Resource
    PromotionalUserServiceImpl promotionalUserService;
    //获取用户地址列表
    public List<Address> getAddress(String token) {
        int uid = jwtService.deconstruction(token).getUid();
        List<Address> addressList = transactionMapper.getAddress(uid);

        return addressList;
    }

    public Address getAddressInfo(int aid){
        return transactionMapper.getAddressInfo(aid);
    }

    //添加地址
    public boolean addAddress(String token, @RequestBody Address address) {
        int uid = jwtService.deconstruction(token).getUid();
        address.setUid(uid);
        return transactionMapper.addAddress(address);
    }

    //修改地址
    public boolean updateAddress(String token, @RequestBody Address address) {
        int uid = jwtService.deconstruction(token).getUid();
        address.setUid(uid);
        return transactionMapper.updateAddress(address);
    }

    //删除地址
    public boolean deleteAddress(String token, @RequestBody Address address) {
        int uid = jwtService.deconstruction(token).getUid();
        address.setUid(uid);
        return transactionMapper.deleteAddress(address);
    }

    public static List<Map<String, String>> parseStringToHashMaps(String input) {
        List<Map<String, String>> mapList = new ArrayList<>();
        Map<String, String> provinceMap = new HashMap<>();
        Map<String, String> cityMap = new HashMap<>();
        Map<String, String> areaMap = new HashMap<>();
        Map<String, String> deliveryMap = new HashMap<>();

        String[] parts = input.substring(1, input.length() - 1).split(",");

        for (String part : parts) {
            String[] keyValue = part.split(":");
            String key = keyValue[0].trim().replaceAll("\"", "");
            String value = keyValue[1].trim().replaceAll("\"", "");

            switch (key) {
                case "prov":
                    provinceMap.put(key, value);
                    break;
                case "city":
                    cityMap.put(key, value);
                    break;
                case "area":
                    areaMap.put(key, value);
                    break;
                case "delivery":
                    deliveryMap.put(key, value);
                    break;
            }
        }
        mapList.add(provinceMap);
        mapList.add(cityMap);
        mapList.add(areaMap);
        mapList.add(deliveryMap);
        return mapList;
    }




    public boolean checkVO(int tid,int pid) {
        MaleList maleList = maleListMapper.selectById(tid);
        List<Integer> list = ListStringUtil.idsToList(maleList.getVoPid());
        if (list != null) {
            return true;
        }
        return !list.contains(pid);
    }



    //添加订单
    public YshopOP addOrder(String token, YshopOP yshopOP) {
        yshopOP.setUid(jwtService.deconstruction(token).getUid());
        YshopOrder yshopOrder = transactionMapper.isAddOrder(yshopOP.getTid(), yshopOP.getUid());
        if (yshopOrder != null){
            YshopOP yshopOPs = transactionMapper.getOrderInfo(yshopOrder.getOid(), yshopOrder.getPayId());
            if (!yshopOPs.getVoPid().equals("[]"))
                yshopOPs.setVOPList(getProductList(yshopOPs.getVoPid()));
            if (!yshopOPs.getRoPid().equals("[]"))
                yshopOPs.setROPList(getProductList(yshopOPs.getRoPid()));
            return yshopOPs;
        }else {
            yshopOP.setOrderId(randomCode.getOrderCode(yshopOP.getUid(), yshopOP.getTid()));
            yshopOP.setStatus(0);
            yshopOP.setCreateTime(new Date());
            yshopOP.setUpdateTime(new Date());
            transactionMapper.addOrder(yshopOP);
            if (transactionMapper.isYShopPay(yshopOP.getUid(), yshopOP.getOid()) == null) {
                yshopOP.setTotalPrice(getTotalPrice(yshopOP.getTid()));
                yshopOP.setPromotionalPrice(yshopOP.getTotalPrice());
                yshopOP.setPaid(0);
                yshopOP.setRefundStatus(0);
                yshopOP.setRefundPrice(0);
                transactionMapper.addYShopPay(yshopOP);
                transactionMapper.updatePayId(yshopOP);
                YshopOP yshopOPs = transactionMapper.getOrderInfo(yshopOP.getOid(), yshopOP.getPayId());
                if (!yshopOPs.getVoPid().equals("[]"))
                    yshopOPs.setVOPList(getProductList(yshopOPs.getVoPid()));
                if (!yshopOPs.getRoPid().equals("[]"))
                    yshopOPs.setROPList(getProductList(yshopOPs.getRoPid()));
                return yshopOPs;
            } else {
                return null;
            }
        }
    }


    //验证是否过期
    public boolean validatePromotionalId(int promotionalId) {
        Date expireTime = transactionMapper.getExpireTime(promotionalId);
        Date currentDate = new Date();
        return expireTime.after(currentDate);
    }

    //验证产品是否可用
    public boolean validateTid(int promotionalId, int tid) {
        String tidList = transactionMapper.getTidList(promotionalId);
        List<Integer> tidListAsIntegers = Arrays.stream(tidList.substring(1, tidList.length() - 1).split(","))
                .map(Integer::parseInt)
                .toList();
        return tidListAsIntegers.contains(tid);
    }

    //获取商品总价格
    public Integer getTotalPrice(int tid) {
        Date preTime = transactionMapper.getPreTime(tid);
       Integer totalPrice;
        if (preTime.after(new Date())) {//判断是否享受优惠价
            totalPrice = transactionMapper.getPrePrice(tid);
        } else {
            totalPrice = transactionMapper.getSalePrice(tid);
        }
        return totalPrice;
    }

    //更新支付订单
    public YshopOP updateYShopPay(String token, Pay yshopPay) throws IOException{

        yshopPay.setUid(jwtService.deconstruction(token).getUid());
        Integer promotionPrice;
        if (yshopPay.getPromotionalId() == 0) {
            //没有优惠卷
            promotionPrice = 0;
        } else {
            //有优惠卷
            promotionPrice = transactionMapper.getPromotionalPrice(yshopPay.getPromotionalId());
        }
        //有推广员的推广码
        Integer spreadId = userMapper.selectSpreadId(yshopPay.getSpreadCode());
        if (spreadId!= null &&!spreadId.equals(yshopPay.getUid())) {
            yshopPay.setSpreadId(spreadId);
        }else {
            yshopPay.setSpreadId(0);
        }
        //获取订单物品单价
        if(yshopPay.getCount()==null){
            yshopPay.setCount(1);
        }
        Integer totalPrice = transactionMapper.getTotalPrice(yshopPay.getOid());
        totalPrice *= yshopPay.getCount();

//        if (yshopPay.getPaid() == 1) {
//             //已支付
//            if (yshopPay.getPayPrice() == (totalPrice - promotionPrice)) {
//                if (yshopPay.getSpreadId() != 0) {
//                    shareSale(yshopPay.getSpreadId(),yshopPay.getPayPrice());      // 分销
//                }
//                //更新订单
//                yshopPay.setPromotionalPrice(yshopPay.getPayPrice());
//                payMapper.updateById(yshopPay);
//                //更新优惠券状态
//                promotionalUserService.logicDelete(yshopPay.getUid(),yshopPay.getPromotionalId());
//                //拉取更新完毕的订单
//                YshopOP yshopOP = getYshopOPInfo(yshopPay.getOid(), yshopPay.getPayId());
//
//                //添加账单管理
//                return addOrderByPay(yshopOP);
//            } else
//                return null;
//        } else {
            //更新订单
            yshopPay.setPromotionalPrice(totalPrice  -  promotionPrice);
            yshopPay.setPayPrice(0);
            yshopPay.setBid(0);
            payMapper.updateById(yshopPay);
            return getYshopOPInfo(yshopPay.getOid(), yshopPay.getPayId());
//        }

    }

    public boolean paysss(String oderId, Integer payPrice)throws IOException{
        YshopOP yshopOP = transactionMapper.getOrderInfos(oderId);
        yshopOP.setBid(addBill(yshopOP.getUid(), yshopOP.getPayId(), yshopOP.getOid()));
        yshopOP.setPaid(1);
        yshopOP.setStatus(1);
        yshopOP.setPayType(1);
        yshopOP.setPayTime(new Date());
        yshopOP.setPayPrice(payPrice);
        if (yshopOP.getSpreadId() != 0) {
            shareSale(yshopOP.getSpreadId(), yshopOP.getPayPrice());      // 分销
        }
       transactionMapper.updateYShopPayss(yshopOP);
        transactionMapper.updateYShopOrderss(yshopOP);
        transactionMapper.deleteRedemptionCode(yshopOP.getOrderId());
        if (!yshopOP.getVoPid().equals("[]")) {
            addVirtualList(yshopOP.getVoPid(), yshopOP.getUid(), "0");
        }
        if (!yshopOP.getRoPid().equals("[]")) {
            addRealList(yshopOP.getRoPid(), yshopOP.getUid(),yshopOP.getAid(),yshopOP.getMark(), yshopOP.getCount(), yshopOP.getOrderId(),yshopOP.getBid(), yshopOP.getName());
            //调物流add
        }
        return true;
    }





    public boolean addOrderByCode(String token, YshopOP yshopOP) throws IOException{
        yshopOP.setUid(jwtService.deconstruction(token).getUid());
        YshopOP news = transactionMapper.getOrderInfo(yshopOP.getOid(), yshopOP.getPayId());

        if (validateRedemptionCode(yshopOP.getOrderId(), news.getTid())) {
            yshopOP.setBid(addBill(yshopOP.getUid(), news.getPayId(), news.getOid()));
            yshopOP.setStatus(1);
            yshopOP.setPayType(2);
            yshopOP.setPayTime(new Date());
            transactionMapper.updateYShopPayss(yshopOP);
            transactionMapper.updateYShopOrderss(yshopOP);
            transactionMapper.deleteRedemptionCode(yshopOP.getOrderId());
            if (!news.getVoPid().equals("[]")) {
                addVirtualList(news.getVoPid(), yshopOP.getUid(), "0");
            }
            if (!news.getRoPid().equals("[]")) {
                addRealList(news.getRoPid(), yshopOP.getUid(), news.getAid(), news.getMark(), news.getCount(), yshopOP.getOrderId(),yshopOP.getBid(), yshopOP.getName());
                //调物流add
            }
            return true;
        } else {
            return false;
        }
    }



//    public YshopOP addOrderByPay(YshopOP yshopOP) throws IOException{
//        yshopOP.setBid(addBill(yshopOP.getUid(), yshopOP.getPayId(), yshopOP.getOid()));
//        yshopOP.setStatus(1);
//        transactionMapper.updateYShopPayss(yshopOP);
//        transactionMapper.updateYShopOrderss(yshopOP);
//        transactionMapper.deleteRedemptionCode(yshopOP.getOrderId());
//
//
//        if (!yshopOP.getVoPid().equals("[]")) {
//            addVirtualList(yshopOP.getVoPid(), yshopOP.getUid(), "0");
//        }
//        if (!yshopOP.getRoPid().equals("[]")) {
//            addRealList(yshopOP.getRoPid(), yshopOP.getUid(), yshopOP.getAid(), yshopOP.getMark(), yshopOP.getCount(), yshopOP.getOrderId(), yshopOP.getBid());
//            //调物流add
//        }
//        return yshopOP;
//
//    }



//        public YshopOP checkAddOder(YshopOP yshopOP){
//        YshopOrder yshopOrder = transactionMapper.isAddOrder(yshopOP.getTid());
//        if (yshopOrder != null){
//            YshopOP yshopOPs = transactionMapper.getOrderInfo(yshopOrder.getOid(), yshopOrder.getPayId());
//            if (!yshopOPs.getVoPid().equals("[]"))
//                yshopOPs.setVOPList(getProductList(yshopOPs.getVoPid()));
//            if (!yshopOPs.getRoPid().equals("[]"))
//                yshopOPs.setROPList(getProductList(yshopOPs.getRoPid()));
//            return yshopOPs;
//        }else
//            return null;
//
//    }



    //分销
    public int shareSale(int spreadId,int payPrice){
        User user = userMapper.selectById(spreadId);
        Membership membership = membershipService.getById(user.getMid());
        Integer addPrice = (membership.getPercentage() * payPrice) / 100;
        user.setNowMoney(user.getNowMoney() + payPrice);
        user.setBrokeragePrice(user.getBrokeragePrice() + addPrice);
        List<Membership> membershipList = membershipService.list();
        userMapper.insertMemberSale(user.getUid(), payPrice, addPrice, user.getBrokeragePrice(),0,user.getOpenId());
        for (Membership membership1:membershipList){
            if (user.getNowMoney() >= membership1.getAmount()){
                user.setMid(membership1.getMid());
            }
        }
        return userMapper.updateById(user);
    }



    //获取订单所有信息
    public YshopOP getYshopOPInfo(int oid, int payId){
        YshopOP yshopOP = transactionMapper.getOrderInfo(oid,payId );
        if (!yshopOP.getVoPid().equals("[]"))
            yshopOP.setVOPList(getProductList(yshopOP.getVoPid()));
        if (!yshopOP.getRoPid().equals("[]"))
            yshopOP.setROPList(getProductList(yshopOP.getRoPid()));
        return yshopOP;
    }




    //判断优惠券是否可用
    public String validatePromotionalInfo(String token,Pay yshopPay) {
        yshopPay.setUid(jwtService.deconstruction(token).getUid());
        if (yshopPay.getPromotionalId() != 0) {
            if (transactionMapper.checkPromotionalId(yshopPay.getPromotionalId())) {//检测该优惠券是否存在
                if (validatePromotionalId(yshopPay.getPromotionalId())) {//验证该优惠券是否过期
                    if (validateTid(yshopPay.getPromotionalId(), yshopPay.getBid())) {//这里tid用bid的存储，验证该优惠券适用于该商品
                        if (transactionMapper.couponValidation(yshopPay.getPromotionalId(), yshopPay.getUid())) {//验证用户是否拥有
                            return "验证通过";
                        } else
                            return "用户未拥有该优惠券";
                    } else
                        return "该商品不可用此优惠";
                } else
                    return "优惠券已过期";
            } else
                return "无效的优惠券id";
        } else {
            return "未使用优惠券";
        }

    }

    public List<ReturnOrderList> ReturnOrderList(String token) {
        int uid = jwtService.deconstruction(token).getUid();
        return transactionMapper.orderListReturn(uid);
    }

    //获取订单号和支付金额并验证
    public Map<String, Object> getOrderInfo(String token, @RequestBody WX_Native_Request wxNativeRequest) {
//        int uid = jwtService.deconstruction(token).getUid();

//        YshopOrder yshopOrder = transactionMapper.checkOrder(uid, wxNativeRequest.getOid());
//        YshopPay yshopPay = transactionMapper.checkPay(uid, );
        YshopOP yshopOP = transactionMapper.getOrderInfo(wxNativeRequest.getOid(),1);
        Map<String, Object> result = new HashMap<>();
        if (yshopOP.getPayId() == yshopOP.getPayId()) {
            result.put("id", yshopOP.getOrderId());
            result.put("price", yshopOP.getPromotionalPrice());
            result.put("tName",yshopOP.getName());
        }
        return result;
    }

    public YshopOP getOrderInfo(int oid) {
        YshopOP yshopOPs = transactionMapper.getOrderInfo(oid, 0);
        if (!yshopOPs.getVoPid().equals("[]"))
            yshopOPs.setVOPList(getProductList(yshopOPs.getVoPid()));
        if (!yshopOPs.getRoPid().equals("[]"))
            yshopOPs.setROPList(getProductList(yshopOPs.getRoPid()));
        return yshopOPs;
    }


    public List<YshopPromotional> getYshopPromotional(String token, int tid) {
        int uid = jwtService.deconstruction(token).getUid();
        List<YshopPromotional> yshopPromotionalList = new ArrayList<>();
        List<Integer> promotionList = new ArrayList<>(transactionMapper.getYshopPromotional(uid));
        if (promotionList.isEmpty()){
            return null;
        }
        if (!(tid == 0)) {
            for (int pid : promotionList) {
                YshopPromotional yshopPromotionals = transactionMapper.getYshopPromotionalList(pid);
                List<Integer> integerList = ListStringUtil.idsToList(yshopPromotionals.getTidList());
                if (integerList.contains(tid))
                    yshopPromotionalList.add(yshopPromotionals);
            }
        } else {
            for (int pid:promotionList){
                yshopPromotionalList.add(transactionMapper.getYshopPromotionalList(pid));
            }
        }

        return yshopPromotionalList;
    }




    //遍历该商品含有的产品信息
    public List<Product> getProductList(String OPid) {
        List<Product> productList = new ArrayList<>();
        List<Integer> pidList = Arrays.stream(OPid.substring(1, OPid.length() - 1).split(","))
                .map(Integer::parseInt)
                .toList();
        for (int pid : pidList) {
            productList.add(transactionMapper.getProduct(pid));
        }
        return productList;
    }

    //遍历添加虚拟商品管理
    public void addVirtualList(String OPid, int uid, String useType) {
        List<Integer> pidList = Arrays.stream(OPid.substring(1, OPid.length() - 1).split(","))
                .map(Integer::parseInt)
                .toList();
        for (int pid : pidList) {
            addVirtualOrder(uid, pid, useType);
        }
    }

    //遍历添加实体商品管理
    public void addRealList(String OPid, int uid, int aid, String mark, int count,String orderId,int bid, String tName) throws IOException{
        List<Integer> pidList = Arrays.stream(OPid.substring(1, OPid.length() - 1).split(","))
                .map(Integer::parseInt)
                .toList();
        for (int pid : pidList) {
            addRealOrder(uid, aid, pid, mark, count, orderId,bid, tName);
        }
    }

    //判断兑换码是否可用该商品
    public boolean validateRedemptionCode(String code, int tid) {
        String tidS = transactionMapper.getCodeTidS(code);
        if (tidS != null) {
            List<Integer> tidList = Arrays.stream(tidS.substring(1, tidS.length() - 1).split(","))
                    .map(Integer::parseInt)
                    .toList();
            return tidList.contains(tid);
        } else
            return false;
    }


    //创建账单
    public int addBill(int uid, int payId, int oid) {
        YshopBill yshopBill = new YshopBill();
        yshopBill.setUid(uid);
        yshopBill.setPayId(payId);
        yshopBill.setOid(oid);
        yshopBill.setUpdateTime(new Date());
        yshopBill.setCreateTime(new Date());
        yshopBill.setPm(0);
        yshopBill.setStatus(1);
        transactionMapper.insertYShopBillAndGetBid(yshopBill);
        return yshopBill.getBid();
    }

    public String checkProductE(int tid,String token){
        int uid = jwtService.deconstruction(token).getUid();
        MaleList maleList = maleListMapper.selectById(tid);
        List<Integer> integerList = transactionMapper.getUserE(uid);
        List<Integer> list = (maleList.getVoPid().equals("[]"))?null:ListStringUtil.idsToList(maleList.getVoPid());
        if (integerList == null || list == null)
            return "success";
        for (Integer element : list) {
            if (integerList.contains(element)) {
                return "您已拥有该商品中的虚拟产品，请选择别的商品购买";
            }
        }
        return "success";
    }


    public void addVirtualOrder(int uid, int pid, String useType) {
        YshopVirtualOrder yshopVirtualOrder = new YshopVirtualOrder();
        yshopVirtualOrder.setUid(uid);
        yshopVirtualOrder.setPid(pid);
        yshopVirtualOrder.setUseType(useType);
        yshopVirtualOrder.setStatus(1);
        yshopVirtualOrder.setCreateTime(new Date());
        yshopVirtualOrder.setIfdis(0);
        transactionMapper.addVirtualOrder(yshopVirtualOrder);
    }

    public void addRealOrder(int uid, int aid, int pid, String mark, int count,String orderId,int bid, String tName)throws IOException {
        RealOrder yshopRealOrder = new RealOrder();
        String version = productService.getById(pid).getVersion();
        System.out.println(version);
        yshopRealOrder.setUid(uid);
        yshopRealOrder.setPid(pid);
        yshopRealOrder.setCount(count);
        yshopRealOrder.setAid(aid);
        yshopRealOrder.setMark(mark);
        yshopRealOrder.setStatus(1);
        yshopRealOrder.setCreateTime(new Date());
        yshopRealOrder.setUpdateTime(new Date());

//        HashMap<String, String> hashMap = null;
//        while (hashMap == null || !hashMap.get("msg").equals("success")){
//            hashMap = getJTEInfo(jteService.addOrder(aid,orderId, tName, version));
//        }
//        //快递单号
//        String deliveryCode = hashMap.get("billCode");
        String deliveryCode = parseBillCode(ztoService.ZTOAddOrder(aid,orderId, tName, version));

        billMapper.deliveryCode(orderId, deliveryCode);
//        Bill bill = new Bill();
//        bill.setBid(bid);
//        bill.setFreightCharge(Integer.parseInt(hashMap.get("sumFreight")) * 100);
//        billMapper.updateById(bill);

//        yshopRealOrder.setDeliverySn("1");
//        yshopRealOrder.setDeliveryName("极兔快递");
        yshopRealOrder.setDeliverySn("2");
        yshopRealOrder.setDeliveryName("中通快递");
        yshopRealOrder.setDeliveryId(deliveryCode);

        realOrderMapper.insert(yshopRealOrder);

//        transactionMapper.addRealOrder(yshopRealOrder);
    }

    public HashMap<String, String> getJTEInfo(JSONObject jsonObject) {
        JSONObject dataObject = jsonObject.getJSONObject("data");
        HashMap<String, String> dataMap = new HashMap<>();
        dataMap.put("code", jsonObject.getString("code"));
        dataMap.put("msg", jsonObject.getString("msg"));
        dataMap.put("txlogisticId", dataObject.getString("txlogisticId"));
        dataMap.put("billCode", dataObject.getString("billCode"));
        dataMap.put("sortingCode", dataObject.getString("sortingCode"));
        dataMap.put("sumFreight", dataObject.getString("sumFreight"));
        dataMap.put("createOrderTime", dataObject.getString("createOrderTime"));
        dataMap.put("lastCenterName", dataObject.getString("lastCenterName"));
        return dataMap;
    }


    public static String parseBillCode(String jsonStr) {
        JSONObject jsonObject = JSONObject.parseObject(jsonStr);
        JSONObject resultObject = jsonObject.getJSONObject("result");
        if (resultObject!= null) {
            return resultObject.getString("billCode");
        }
        return null;
    }



    public boolean check(int oid){
        return  transactionMapper.checkIsPay(oid);
    }

//    public YshopOP checkAddOder(YshopOP yshopOP){
//        YshopOrder yshopOrder = transactionMapper.isAddOrder(yshopOP.getTid());
//        if (yshopOrder != null){
//            YshopOP yshopOPs = transactionMapper.getOrderInfo(yshopOrder.getOid(), yshopOrder.getPayId());
//            if (!yshopOPs.getVoPid().equals("[]"))
//                yshopOPs.setVOPList(getProductList(yshopOPs.getVoPid()));
//            if (!yshopOPs.getRoPid().equals("[]"))
//                yshopOPs.setROPList(getProductList(yshopOPs.getRoPid()));
//            return yshopOPs;
//        }else
//            return null;
//
//    }


    public List<ReturnOrderList> orderUserListReturn(String token){
        return transactionMapper.orderUserListReturn(jwtService.deconstruction(token).getUid());
    }




}
